Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Reading and writing object attributes

Once you have the handle to an object, you can change its appearance and behavior through its handle. To locate all the objects in the sample procedure’s frame, you start with the field group’s FIRST-CHILD, which is now in the hObject variable, and walk through the chain of NEXT-SIBLING objects as long as the object handle remains valid.

For example, assume you want to identify each fill-in field in the frame. For each one that is an integer field, you want to disable the field and set its background color to a dark gray. For each other fill-in field, you want to set the background color to green to highlight the field for data entry.

To start with, changeFields looks at the TYPE attribute of each object to see if it is a FILL-IN. If it is, then it checks the DATA-TYPE attribute to see if the field is an INTEGER. If it is, then it sets its SENSITIVE attribute to false and its BGCOLOR attribute to 8, which represents the color gray. Otherwise, if the field is not an integer, it sets the BGCOLOR attribute to 10, which is the color green:

DO WHILE VALID-HANDLE(hObject): 
    IF hObject:TYPE = "FILL-IN" THEN 
    DO: 
        IF hObject:DATA-TYPE = "INTEGER" THEN 
            ASSIGN hObject:SENSITIVE = NO 
                   hObject:BGCOLOR = 8. 
        ELSE hObject:BGCOLOR = 10. 
    END. 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095